import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex)

const store = new Vuex.Store({
    // 状态：用于存储数据
    state: {
        myUser: {
            msg: '我是默认的用户',
            img: 'http://n1.itc.cn/img8/wb/sohulife/2021/05/06/162028122836106972.JPEG'
        },
        myMusic: {},
        myVideo: {}
    },
    // 修改事件：通过这个方式修改，才会触发全局修改
    mutations: {
        setUser(state, user1) {
            state.myUser = user1;
        },
        setMyMusic(state, myMusic2) {
            state.myMusic = myMusic2;
        }
    }
})

export default store